home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 05.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-04-11  |  6.7 KB  |  375 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. Type = strip(line)
  22. line = readln(TempFile)
  23. MType = strip(line)
  24. call close (TempFile)
  25. j=0
  26.  
  27. TFrames = Frames
  28. if Field = 1 then TFrames = Frames*2
  29. do i = 1 to Frames
  30.     call open TempFile,"RAM:VFXNums",W
  31.     call writeln TempFile,right(i,5,'0')
  32.     call writeln TempFile,right(Frames,5,'0')
  33.     call close TempFile
  34.     f=0
  35.     Redraw Off
  36.     FieldSet = 0
  37.     if Padding ~= -1 & i = 1 then call PadIt(1)
  38.     call LoadB()
  39.     call LoadA()
  40.     j = j+ 1
  41.     call DoIt()
  42.     Redraw On
  43.     call SaveIt()
  44.         if Field = 1 then do
  45.             Redraw Off
  46.             FieldSet = 1
  47.             call LoadB()
  48.             call LoadA()
  49.             j = j + 1
  50.             call DoIt()
  51.             Redraw On
  52.             call SaveIt()
  53.             end 
  54.     if Padding ~= -1 & i = Frames then call PadIt(2)
  55.     end
  56.     if SaveType = 0 then do
  57.         if Padding = -1 then
  58.             call MakeIcon(SaveName,(Frames-10))
  59.         else
  60.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  61.         end
  62.     Undo On
  63. exit
  64.  
  65.  
  66. PadIt:
  67. arg PadNum
  68.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  69.         Undo On
  70.         exit
  71.         end
  72.          if PadNum = 1 then do
  73.        if IAType = 0 then do
  74.         do Pad = Padding to 1 by -1
  75.             LoadBuffer PicAName Force StartA-(Pad-1)
  76.             call Switcher(TOSW)
  77.             call Switcher(MDV1)
  78.             Render Go
  79.                 call RecordAdd(SaveName,2,6,Compression)
  80.             end
  81.         end
  82.        if IAType = 1 then do
  83.         LoadBuffer PicAName Force 1
  84.         call Switcher(TOSW)
  85.         call Switcher(MDV1)
  86.         Render Go
  87.             call RecordAdd(SaveName,2*Padding,6,Compression)
  88.         end
  89.        if IAType = 2 then do
  90.         LoadBuffer PicAName Force
  91.         call Switcher(TOSW)
  92.         call Switcher(MDV1)
  93.         Render Go
  94.             call RecordAdd(SaveName,2*Padding,6,Compression)
  95.         end
  96.        if IAType = 3 then do
  97.         do Pad = Padding to 1 by -1
  98.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  99.             call Switcher(TOSW)
  100.             call Switcher(MDV1)
  101.             Render Go
  102.                 call RecordAdd(SaveName,2,6,Compression)
  103.             end
  104.         end
  105.     end 
  106.     else do
  107.        if IBType = 0 then do
  108.         do Pad = 1 to Padding
  109.             LoadBuffer PicBName Force StartB+Pad+TFrames
  110.             call Switcher(TOSW)
  111.             call Switcher(MDV1)
  112.             Render Go
  113.                 call RecordAdd(SaveName,2,6,Compression)
  114.             end
  115.         end
  116.        if IBType = 1 then do
  117.         LoadBuffer PicBName Force 1
  118.         call Switcher(TOSW)
  119.         call Switcher(MDV1)
  120.         Render Go
  121.             call RecordAdd(SaveName,2*Padding,6,Compression)
  122.         end
  123.        if IBType = 2 then do
  124.         LoadBuffer PicBName Force
  125.         call Switcher(TOSW)
  126.         call Switcher(MDV1)
  127.         Render Go
  128.             call RecordAdd(SaveName,2*Padding,6,Compression)
  129.         end
  130.        if IBType = 3 then do
  131.         do Pad = 1 to Padding
  132.             LoadBuffer PicBName""right(StartB+Pad+TFrames),3,'0') Force
  133.             call Switcher(TOSW)
  134.             call Switcher(MDV1)
  135.             Render Go
  136.                 call RecordAdd(SaveName,2,6,Compression)
  137.             end
  138.         end
  139.     end
  140. return
  141.  
  142.  
  143. LoadA:
  144.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  145.         Undo On
  146.         exit
  147.         end
  148.     if j = TFrames then return
  149.     if IAType = 0 then do
  150.         LoadBuffer PicAName Force i+StartA
  151.         end
  152.     if IAType = 1 then do
  153.         LoadBuffer PicAName Force 1
  154.         end
  155.     if IAType = 2 then do
  156.         LoadBuffer PicAName Force
  157.         end
  158.     if IAType = 3 then do
  159.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  160.         end
  161.  
  162. return
  163.  
  164. LoadB:
  165.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  166.         Undo On
  167.         exit
  168.         end
  169.     if j = 1 then return
  170.     if IBType = 0 then do
  171.         LoadBuffer PicBName Force i+StartB
  172.         end
  173.     if IBType = 1 then do
  174.         LoadBuffer PicBName Force 1
  175.         end
  176.     if IBType = 2 then do
  177.         LoadBuffer PicBName Force
  178.         end
  179.     if IBType = 3 then do
  180.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  181.         end
  182.     Swap
  183. return
  184.  
  185.  
  186. SaveIt:
  187.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  188.         Undo On
  189.         exit
  190.         end
  191.     if SaveType = 0 then do
  192.         call Switcher(TOSW)
  193.         call Switcher(MDV1)
  194.  
  195.         Render Go
  196.         if Field = 1 then
  197.                 call RecordAdd(SaveName,1,6,Compression)
  198.         else
  199.                 call RecordAdd(SaveName,2,6,Compression)
  200.         end
  201.  
  202.     if SaveType = 1 then do
  203.         if Field = 1 then do
  204.             f= f + 1
  205.             if f = 1 then
  206.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  207.             if f = 2 then do
  208.                 GetMain
  209.                 parse var result Name Width Height Blah
  210.                 Scale Width Height/2
  211.                 Swap
  212.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  213.                 Scale Width Height/2
  214.                 Hook Interlace
  215.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  216.                 f = 0
  217.                 end
  218.             end
  219.         else do
  220.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  221.             end    
  222.         end
  223. return
  224.  
  225.  
  226. DoIt:
  227.     if j = TFrames then do
  228.         Swap
  229.         return
  230.         end
  231.     if j = 1 then do
  232.         GetMain
  233.         Parse Var result name width height blah
  234.         Hmid=height/2
  235.         Wmid=width/2
  236.         Tot=(height*2)+(width*2)
  237.         stp=Tot/(TFrames-2)
  238.         edtype = Type
  239.         IF edtype=0 THEN EdgeMode FeatherOut 4
  240.         IF edtype=1 THEN EdgeMode FeatherOut 20
  241.         IF edtype=2 THEN EdgeMode Normal 0
  242.         ActiveColor 1
  243.         DrawMode Normal
  244.         DrawStyle Normal
  245.         Pen 0 1
  246.         Blend 100
  247.         AlphaChannel Off
  248.         FillMode Solid 0 0 0 SMOOTH
  249.         Apos=Wmid
  250.         Bpos=0
  251.         Cpos=Wmid+stp
  252.         Dpos=0
  253.         Epos=Wmid+1
  254.         Fpos=Hmid/2
  255.         pt=0
  256.         return
  257.         end
  258.  
  259.     if MType ~= 0 then do
  260.         Swap
  261.         HorizFlip
  262.         Swap
  263.         HorizFlip
  264.         end
  265.     NewArea
  266.      AddArea Wmid Hmid
  267.      AddArea Apos Bpos
  268.      DrawStyle Normal
  269.      IF pt=1 THEN CALL Firstpos
  270.      IF pt=2 THEN CALL Secpos
  271.      IF pt=3 THEN CALL Tripos
  272.      IF pt=4 THEN CALL Fourpos
  273.      AddArea Cpos Dpos
  274.      DrawStyle RubThrough
  275.      FilledPoly
  276.     CALL picker
  277.      DrawStyle Normal
  278.     if MType ~= 0 then do
  279.         HorizFlip
  280.         end
  281. return
  282.  
  283.  
  284. Firstpos:
  285.  AddArea width 0
  286. Return
  287.  
  288. Secpos:
  289.  AddArea width 0
  290.  AddArea width height
  291. Return
  292.  
  293. Tripos:
  294.  AddArea width 0
  295.  AddArea width height
  296.  AddArea 0 height
  297. Return
  298.  
  299. Fourpos:
  300.  AddArea width 0
  301.  AddArea width height
  302.  AddArea 0 height
  303.  Addarea 0 0
  304. Return
  305.  
  306. picker:
  307.   SELECT
  308.     WHEN pt=0 THEN CALL topa
  309.     WHEN pt=1 THEN CALL righta
  310.     WHEN pt=2 THEN CALL bota
  311.     WHEN pt=3 THEN CALL lefta
  312.     WHEN pt=4 THEN CALL topb
  313.   END
  314. Return
  315.  
  316.  
  317. topa:
  318.    IF (Cpos+stp)>width THEN pt=1
  319.    IF (Cpos+stp)>width THEN CALL rightone
  320.    IF (Cpos+stp)<width THEN Cpos=Cpos+stp
  321.  
  322. Return
  323.  
  324. rightone:
  325.    Ustp=(Cpos+stp)-width
  326.    Nstp=stp-Ustp
  327.    Cpos=width
  328.    Dpos=Dpos+Nstp
  329. Return
  330.  
  331.  
  332. righta:
  333.    IF (Dpos+stp)>height THEN pt=2
  334.    IF (Dpos+stp)>height THEN CALL botone
  335.    IF (Dpos+stp)<height THEN Dpos=Dpos+stp
  336. Return
  337.  
  338. botone:
  339.    Ustp=(Dpos+stp)-height
  340.    Nstp=stp-Ustp
  341.    Dpos=height
  342.    Cpos=Cpos-Nstp
  343. Return
  344.  
  345. bota:
  346.    IF (Cpos-stp)<0 THEN pt=3
  347.    IF (Cpos-stp)<0 THEN CALL leftone
  348.    IF (Cpos-stp)>0 THEN Cpos=Cpos-stp
  349. Return
  350.  
  351. leftone:
  352.    Nstp=stp-Cpos
  353.    Cpos=0
  354.    Dpos=Dpos-Nstp
  355. Return
  356.  
  357. lefta:
  358.    IF (Dpos-stp)<0 THEN pt=4
  359.    IF (Dpos-stp)<0 THEN CALL topone
  360.    IF (Dpos-stp)>0 THEN Dpos=Dpos-stp
  361. Return
  362.  
  363. topone:
  364.    Nstp=stp-Dpos
  365.    Dpos=0
  366.    Cpos=Cpos+Nstp
  367. Return
  368.  
  369. topb:
  370.    IF (Cpos+stp)>Wmid THEN Cpos=Wmid
  371.    IF (Cpos+stp)<Wmid THEN Cpos=Cpos+stp
  372. Return
  373.  
  374.  
  375.